package com.leyou.task.job;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Slf4j
//@Component
public class HelloJob2 {

    private int count = 1;

    /**
     * 效果与固定延时执行一致
     */
    @Scheduled(cron = "0/2 * * * * ?")
    public void cleanTimeOutOrder() throws InterruptedException {
        log.info("crontask ==> 定时清理订单============>"+count);
        if(count == 1){
            Thread.sleep(4000);
        }
        count++;
    }
}
